#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>


int main()
{
	int n = 0, a = 0, b = 0;
	while (scanf("%d", &n) != EOF)
	{
		for (a = 1;a <= n;a++)
		{
			for (b = 1;b <= n;b++)
			{
				if (a == 1 || a == n ||b==1||b==n)
					printf("* ");
				else
					printf("  ");
			}
			printf("\n");
		}
	}
	return 0;
}